package com.greensam.common.mq;

import lombok.AllArgsConstructor;
import lombok.Getter;

import javax.servlet.http.HttpServletResponse;

/**
 * @Author: Machengrui
 * @Date: 2024/9/23 21:21
 */
@Getter
@AllArgsConstructor
public enum ResultCode implements ErrorCode{

    //操作成功以2开头
    SUCCESS(HttpServletResponse.SC_OK, "code_200"),
    SAVE_SUCCESS(212, "code_212"),
    UPDATE_SUCCESS(214, "code_214"),
    REMOVE_SUCCESS(216, "code_216"),
    CANCEL_SUCCESS(218, "code_218"),
    CONFIG_SUCCESS(220, "code_220"),

    //401：请求要求用户的身份认证
    UNAUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "code_401"),
    FORBIDDEN(HttpServletResponse.SC_FORBIDDEN, "code_403"),
    VALIDATE_FAILED(HttpServletResponse.SC_NOT_FOUND, "code_404"),

    //操作失败以5开头
    FAILED(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "code_500"),
    SAVE_ERROR(511, "code_511"),
    UPDATE_ERROR(513, "code_513"),
    REMOVE_ERROR(515, "code_515"),
    CANCEL_ERROR(517, "code_517"),
    VALID_ERROR(519, "code_519");

    private final long code;
    private final String propertyKey;

    @Override
    public String getMessage() {
        return getPropertyKey();
    }
}
